package com.example.boot.service.schedule.impl;

import com.example.boot.service.schedule.IScheduleService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

@Service
public class ScheduleServiceImpl implements IScheduleService {

    @Override
    @Scheduled(cron="0 0/10 * * * ? ")
    public void testSchedule() {
        try {
            DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            System.out.println(sdf.format(new Date())+"*********每10分钟执行一次进入测试");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
